#ifndef SANDBOX_SDK_UTIL_SORTED_QUEUE_HPP
#define SANDBOX_SDK_UTIL_SORTED_QUEUE_HPP

#include "allocator_details.hpp"
#include <type_traits>

namespace sandbox
{
	namespace sdk 
	{
		/**
		 * \brief template <size_t T> class SortedQueue;
		 *        An allocator, which can quickly allocate and free 
		 *        chunks of size 'SIZE'.
		 * 
		 * RawPoolAllocator is movable, noncopyable allocator
		 * useful to quicky allocate and remove t
		 */
		template <class Key, class Value, class Compare=std::less<Key>> 
		class OrderedQueue {
			static_assert(std::is_pod<Key>::value==true);
			static_assert(std::is_pod<Value>::value==true);
		public:
			typedef struct {
				OrderedQueue * m_queue;
				void         * m_chunk;
				size_t         m_offset;
			}iterator;
			
			typedef struct {
			}const_iterator;
			
			OrderedQueue()
			{
			
			}
			~OrderedQueue() throw()
			{
			}
			
			template <Key key, typename Args ...>
			void emplace(Args ... parameters){
				
			}
			void 
			void compact();
		private:
			struct chunk_handle {
				Key    key;
				void * pointer;
				
				~chunk_handle()
				{
					if(pointer!=NULL)aligned::free(pointer);
				}
			};
			
			void * m_chunk0;
			void **m_partially_free_chunks;
			
		};
	}	
}
#endif //SANDBOX_SDK_UTIL_POOL_ALLOCATOR_HPP

